package com.tiny.climber;

import java.awt.Color;
import java.awt.Graphics2D;

import com.tiny.core.game.Game;
import com.tiny.core.game.GameObject;
import com.tiny.core.game.util.MovimentCalculator;

public class EvilLava extends GameObject {

    private int lava_vel;
    private MovimentCalculator calc;

    public EvilLava(int y, Game game) {
        super(0, y, game.getWidth(), game.getHeight());
        lava_vel = 50;
        this.calc = game.getMovimentCalculator();
    }

    @Override
    public void render(Graphics2D g) {
        g.setColor(Color.RED);
        g.fillRect((int)pos.x, (int)pos.y, (int)pos.width, (int)pos.height);
    }

    @Override
    public void update(int currentTick) {
        getPos().y -= calc.calculate(lava_vel);
        if (isColling() && getColling() instanceof Plataform && getColling().getPos().y >= pos.y ) {
            getColling().setEnergy(0);
        }
    }

    public int getLavaVel() {
        return lava_vel;
    }

    public void setLavaVel(int lavalVel) {
        this.lava_vel = lavalVel;
    }
}
